// joint.h
#ifndef JOINT_H
#define JOINT_H

#include <QWidget>
#include <QSlider>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QGridLayout>
#include <QGroupBox>
#include <QJsonObject>
#include <QIntValidator>
#include <QMessageBox>
class Joint : public QWidget
{
    Q_OBJECT

public:
    explicit Joint(const QString &jointName, const QJsonObject &jointDetails, QWidget *parent = nullptr);
    QWidget* getWidget() ;
    void reset();
    void reset(QString name);
    QLineEdit* getAngleDisplay();
    QString getJointName();

private:
    QString m_jointName;
    double m_min;
    double m_max;
    double m_default;
    QSlider *m_slider;
    QLineEdit *m_angleDisplay;
    QPushButton *decreaseButton;  // 声明按钮
    QPushButton *increaseButton;  // 声明按钮

    void setupControls(const QJsonObject &jointDetails);
    void connectSignals();

signals:
    // 新的信号：当角度值变化时发出
    void angleChanged(const QString &jointName, double angle);

public slots:
    // void onSliderValueChanged(int value);

};

#endif // JOINT_H
